package jmu.zzh.alumnus.user.service;

import jmu.zzh.alumnus.user.entity.Class;
import jmu.zzh.alumnus.user.entity.College;
import jmu.zzh.alumnus.user.entity.Major;
import jmu.zzh.alumnus.user.mapper.ClassMapper;
import jmu.zzh.alumnus.user.mapper.CollegeMapper;
import jmu.zzh.alumnus.user.mapper.MajorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SchoolInfoService {

    @Autowired
    private CollegeMapper collegeMapper;

    @Autowired
    private MajorMapper majorMapper;

    @Autowired
    private ClassMapper classMapper;

    public List<College> getCollegesByYear(Integer year) {
        return collegeMapper.selectByYear(year);
    }

    public List<Major> getMajorsByCollegeAndYear(String collegeCode, Integer year) {
        return majorMapper.selectByCollegeAndYear(collegeCode, year);
    }

    public List<Class> getClassesByCollegeAndYear(String collegeCode, Integer year) {
        return classMapper.selectByCollegeAndYear(collegeCode, year);
    }

    public List<College> getAllColleges() {
        return collegeMapper.selectAll();
    }

    public List<Major> getAllMajors() {
        return majorMapper.selectAll();
    }

    public List<Class> getAllClasses() {
        return classMapper.selectAll();
    }
} 